package com.sz.common.core.system.service.impl;

import com.sz.common.base.service.AbstractService;
import com.sz.common.core.system.entity.MenuPermission;
import com.sz.common.core.system.service.MenuPermissionService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * Function: MenuPermissionServiceImpl <br>
 * Author: hpeng.wang <br>
 * Date: 2016-10-26 13:41:00
 */
@Service("menuPermissionService")
public class MenuPermissionServiceImpl extends AbstractService implements MenuPermissionService {

    @Override
    protected String getMapperNamespace() {
        return "MenuPermissionMapper";
    }


    @Override
    public List<MenuPermission> findMenuPerListByMenuId(Integer menuId) {
        List<MenuPermission> menuPermissionList = dao.findForList(getSqlName
                ("findMenuPerListByMenuId"), menuId, MenuPermission.class);
        return menuPermissionList;
    }

    @Override
    public List<MenuPermission> findMenuPerListByMenuIds(List<Integer> menuIds) {
        List<MenuPermission> menuPermissionList = new ArrayList<>();

        if (menuIds != null && menuIds.size() > 0) {
            menuPermissionList = dao.findForList(getSqlName("findMenuPerListByMenuIds"), menuIds,
                    MenuPermission.class);
        }
        return menuPermissionList;
    }
}
